<template>
  <div class="iframe-content">
    <components ref="codeTemplate" v-bind:is="codeTemplate" />
  </div>
</template>

<script>
import mainStart from "./mixin/main/start/index.vue";
import mainEvent from "./mixin/main/event/index.vue";
import metricScale from "./mixin/draw/metricScale/index.vue";
import drawTool from "./mixin/draw/drawTool/index.vue";
import mapSetting from "./mixin/draw/mapSetting/index.vue";
import featurePoint from "./mixin/feature/point/index.vue";
import featureLine from "./mixin/feature/line/index.vue";
import featureArea from "./mixin/feature/area/index.vue";
import baseShip from "./mixin/ship/baseShip/index.vue";
import pointShip from "./mixin/ship/pointShip/index.vue";
import realShip from "./mixin/ship/realShip/index.vue";
import trajectoryDraw from "./mixin/track/trajectoryDraw/index.vue";
import trajectoryAnimation from "./mixin/track/trajectoryAnimation/index.vue";
import layerCenter from "./mixin/layer/layerCenter/index.vue";
import layerDiy from "./mixin/layer/layerDiy/index.vue";
import typhoon from "./mixin/weather/typhoon/index.vue";
import weather from "./mixin/weather/weather/index.vue";
export default {
  components: {
    mainStart,
    mainEvent,
    metricScale,
    drawTool,
    mapSetting,
    featurePoint,
    featureLine,
    featureArea,
    baseShip,
    pointShip,
    realShip,
    trajectoryDraw,
    trajectoryAnimation,
    layerCenter,
    layerDiy,
    typhoon,
    weather,
  },
  data() {
    return {
      codeTemplate: undefined,
    };
  },
  methods: {
    codeRun(code) {
      const codeTemplate = this.codeTemplate;
      this.codeTemplate = undefined;
      this.$nextTick(() => {
        this.codeTemplate = codeTemplate;
        this.$nextTick(() => {
          this.$refs.codeTemplate.codeRun(code);
        });
      });
    },
  },
  mounted() {},
};
</script>

<style scoped lang="scss">
.iframe-content {
  width: 100%;
  height: 100%;
  padding: 0 5px 5px 5px;
}
</style>
